package family.console;

/**
 * This is the Person class which contains all variables 
 * and all getter and setter of the variables.
 * 
 * @author Edis Dilji
 * @version 3.0, November 4, 2012
 */

// CLASSDEFINITION
public class Person {

	// VARIABLES
	private String name;
	private Gender gender;
	Person father;
	Person mother;

	// CONSTRUCTOR empty
	public Person() {
	}

	// CONSTRUCTOR name
	public Person(String name) {
		this.name = name;
	}

	// CONSTRUCTOR name and gender
	public Person(String name, Gender gender) {
		this.name = name;
		this.gender = gender;
	}

	// toString
	public String toString() {

		// get the father of the person, if father not null
		String fathername = father == null ? "" : " father=" + father.getName();
		// get the mother of the person, if father not null
		String mothername = mother == null ? "" : " mother=" + mother.getName();

		// return the name, gender, father (if exist) and mother (if exist) of the person
		return this.name + " (" + gender + ") " + fathername + mothername;
	}

	// getter Name
	public String getName() {
		return name;
	}

	// setter Name
	public void setName(String name) {
		this.name = name;
	}

	// create enum Gender
	public enum Gender {
		male, female
	}

	// getter Gender
	public Gender getGender() {
		return gender;
	}

	// setter Gender
	public void setGender(Gender gender) {
		this.gender = gender;
	}

	// getter Father
	public Person getFather() {
		return father;
	}

	// setter Father
	public void setFather(Person father) {
		this.father = father;
	}

	// getter Mother
	public Person getMother() {
		return mother;
	}

	// setter Mother
	public void setMother(Person mother) {
		this.mother = mother;
	}

}
